﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FL.Web.BackEnd.Controllers.Finance;

namespace FL.WebUI.ReportList
{

    public partial class ReportCustomOrFin : System.Web.UI.Page
    {
        public string customerName = null;
        public string customerShortName = null;
        public string jsyName = null;
        public string chargeName = null;
        public string jsyTel = null;
        public string billNos = null;
        public string secondCustomer = null;
        public string printIds = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GetPrintTitleData();
                
            }

        }

        protected void GetPrintTitleData()
        {
            if (System.Web.HttpContext.Current.Session["printIds"] != null)
            {
                printIds = System.Web.HttpContext.Current.Session["printIds"].ToString();
                printIds = printIds.Replace("'", "|");
                
            }
            string id = string.IsNullOrEmpty(Request["id"]) ? "0" : Request["id"];
            
            string billNo = string.IsNullOrEmpty(Request["billNo"]) ? "0" : Request["billNo"];
            
            CustomTmpController con = new CustomTmpController();
            DataTable dt = con.GetPrintTitle(id,billNo);
            if (dt.Rows.Count>0)
            {
                customerName = dt.Rows[0]["customer_name"].ToString();
                customerShortName = dt.Rows[0]["customer_short"].ToString();
                jsyName = dt.Rows[0]["jsy_name"].ToString();
                chargeName = dt.Rows[0]["charge_name"].ToString();
                jsyTel = dt.Rows[0]["jsy_office_tel"].ToString();
                billNos = dt.Rows[0]["arp_bill_no"].ToString();
                secondCustomer = dt.Rows[0]["customer01_name"].ToString();
            }
        }

        protected string getHeader()
        {
            string headers=@"[{ fieldName: ""OrderID"", fieldType: 2, description: ""产品名称"", width: 2.78 },
                        { fieldName: ""CustomerID"", fieldType: 1, description: """", width: 0 },
                        { fieldName: ""CompanyName"", fieldType: 1, description: """", width: 0 },
                        { fieldName: ""OrderDate"", fieldType: 6, description: """", width: 0 },
                        { fieldName: ""Freight"", fieldType: 3, description: """", width: 0 },
                        { fieldName: ""ProductID"", fieldType: 2, description: """", width: 0 },
                        { fieldName: ""ProductName"", fieldType: 1, description: """", width: 0 },
                        { fieldName: ""UnitPrice"", fieldType: 3, description: ""单价"", width: 1.98 },
                        { fieldName: ""Quantity"", fieldType: 2, description: ""数量"", width: 1.59 },
                        { fieldName: ""Discount"", fieldType: 3, description: ""折扣"", width: 1.80 },
                        { fieldName: ""Amount"", fieldType: 3, description: ""折扣前金额"", width: 2.38 },
                        { fieldName: ""DiscountAmt"", fieldType: 3, description: """", width: 0 },
                        { fieldName: ""NetAmount"", fieldType: 3, description: ""折扣后金额"", width: 2.38 }]";
            return headers;
        }
    }
}